<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no" name="format-detection">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1;user-scalable=no;">
    <title>1起购</title>
    <link rel="stylesheet" href="/statics/view/css/bootstrap.css">
    <link rel="stylesheet" href="/statics/view/css/style.css">
    <link rel="stylesheet" href="/statics/view/css/member.css">
    <link rel="stylesheet" href="/statics/view/css/order3.css">
    <script charset="utf-8" src="/statics/view/js/jquery.min.js"></script>

</head>
<body style="background-color:#fff">

<div class="maincontainer">
    <div class="container itemdetail mini-innner">
        <div class="row">
            <header class="header" style="height:44px;">
                <div class="fix_nav">
                    <div style="max-width:768px;margin:0 auto;background:#db3652;position: relative;">
                        <a class="nav-left back-icon" href="/login">返回</a>
                        <div class="tit">帐号绑定-免登陆</div>
                        <a class="nav-right icon-home" href="/dbs/index.html">首页</a>
                    </div>
                </div>
            </header>
        </div>
        <div class="row mt20"></div>
        <div class="row">
            <div class="col-md-12" data-validform="mobileBind">
                <form id="mobileBind" action="/bind/bind-mobile-validate"  class="form-horizontal"  method="post">

                    <div class="form-group">
                        <label for="phone" class="col-xs-offset-1 col-xs-2 control-label p0">手机号：</label>
                        <div class="col-sm-7 col-xs-9">
                            <input type="text" name="mobile" id="username" maxlength="11" class="form-control" placeholder="请输入您的手机号码">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="phone" class="col-xs-offset-1 col-xs-2 control-label p0">密码：</label>
                        <div class="col-sm-7 col-xs-9">
                            <input type="password" name="password" id="password" class="form-control" placeholder="请输入您的登录密码" autocomplete="off">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="code" class="col-xs-offset-1 col-xs-2 control-label p0">验证码：</label>
                        <div class="col-sm-4 col-xs-4 pr0">
                            <input type="text" name="smsCode" class="form-control" id="smsCode" placeholder="6位手机验证码">
                        </div>
                        <div class="col-sm-3 col-xs-5">
                            <input type="button" class="form-control btn btn-primary get_mobile_code"  id="getCode" data-type="wapLogin" value="获取手机验证码" style="padding:0px;">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-xs-offset-3 col-xs-6 mt10">
                            <button  class="btn btn-success vip_reg btn-lg" onclick="javascript:$('#mobileBind').submit();">确定绑定</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

</div>
<script type="text/javascript" src="/statics/view/js/common.js"></script>
<script type="text/javascript" src="/statics/view/js/jquery.validate.js"></script>
<script type="text/javascript" src="/statics/layer.m/layer.m.js"></script>
<script type="text/javascript">
    $().ready(function() {
        var $mobileBind = $("#mobileBind");
        var $mobile = $("input[name='mobile']");
        var $smsCode = $("input[name='smsCode']");
        var $password = $("input[name='password']");

        $mobileBind.validate({
            rules: {
                mobile: "required",
                password: "required",
                smsCode: "required"
            },
            submitHandler: function(form) {
                layer.open({
                    type: 2,
                    content: '提交中~'
                });
                $.ajax({
                    url: $mobileBind.attr("action"),
                    type: "POST",
                    data: {
                        mobile: $mobile.val(),
                        password: $password.val(),
                        smsCode : $smsCode.val()
                    },
                    dataType: "json",
                    cache: false,
                    success: function(message) {
                        layer.closeAll();
                        if (message.type == "success") {
                        [#if redirectUrl??]
                            location.href = "${redirectUrl}";
                        [#else]
                            location.href = "/";
                        [/#if]
                        } else {
                            layer.open({
                                content: message.content,
                                time: 2
                            });
                        }
                    },error:function(){
                        layer.closeAll();
                        layer.open({
                            content: "服务器异常",
                            time: 2
                        });
                    }
                });
            }
        });
    });
</script>

</body>
</html>